<%@ page import="java.util.ArrayList,models.*,com.opensymphony.xwork2.ActionContext"  %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Home Page</title>

<meta name="keywords" content="Basic look and feel" />

<meta name="description" content="this is the base template html and css" />

<link href="style.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div id="header_wrapper">

<div id="header">

<div id="site_title_section">

<div id="site_title">
	          Issue Suite
            </div>
      
<div id="salogon">
	            The Issue Tracker </div>
            
<div class="cleaner">&nbsp;</div>
        
</div>
            
<div id="login_section" align="right" class="text_font">
            
<s:form action="logout.action" method="post">
    <table align="right">
<tr></tr><tr></tr>
<tr></tr><tr></tr>
<tr></tr><tr></tr>
<tr></tr><tr></tr>
<tr></tr><tr></tr><tr></tr>
<tr>
<s:if test="%{#session.loggedin == 'admin' }">  
  <td >You are logged in as Admin </td><td></td><td></td><td></td><td></td><td></td>
  


 </s:if>  
<s:else>

<td >You are logged in as <s:property value="%{#session.Developer.uname}" /></td><td>!!</td> <td></td><td></td><td></td><td></td><td></td>


</s:else>

<td>
<div><s:submit name = "commandButton" value="Logout" 
          align="center" theme="simple" id="mylogin"  /></div>
</td>
<td></td>
</tr>
</table>
</s:form>
     
</div>    
    
</div> <!-- end of header -->
</div>
<!-- end of header wrapper -->


<div id="banner_wrapper">
    
<div id="banner">
    
        
<div id="banner_header_01">Welcome to Issue Suite</div>
        
<div id="banner_header_02">Make your software close to Perfection</div>
        
<div id="banner_text">
            
<p>You feel a strong need in the universal management tools that will help optimize your and your team's work in a couple of clicks? An issue tracking tool will be easy and pleasant to deal with. Then Issue Suite is exactly you need. Issue Suite is a user-friendly issue tracking system.</p>
            
<div class="rc_btn_01"><a href="<s:url value="/aboutUsPostLogin.jsp" />">Continue reading...</a></div>
        
</div>
    
</div>	
<!-- end of banner -->

</div> 
<!-- end of banner wrapper -->



<div id="menu_wrapper">    
    
<div id="menu">
        
<ul>
            
<li><a href="<s:url value="/postLogin.jsp" />" target="_parent"><span></span>Home</a></li>

<li><a href="<s:url value="/aboutUsPostLogin.jsp" />" target="_parent"><span></span>About Us</a></li>

<li><a href="<s:url value="/account.jsp" />"><span></span>Profile</a></li>
                       
<li><a href="#" class="current"><span></span>Ticket Details</a></li>
            

        
</ul>    	
    
</div> 
<!-- end of menu -->
</div> 
<!-- end of menu wrapper -->


<div id="content_wrapper" align="center">

<div id="content" align="center" class="text_font">
<fieldset class="boxBody">
<%@ page import="java.util.ArrayList,models.*,com.opensymphony.xwork2.ActionContext"  %>

<h4 align = "left"><s:label theme="simple">Issue number :</s:label><s:property value="%{#session.Issue.issue_num}" /></h4>

<h4 align = "left">	<s:label theme="simple">Issue subject :</s:label><s:property value="%{#session.Issue.issue_subject}" /></h4>

<h4 align = "left">	<s:label theme="simple">Description :</s:label><s:property value="%{#session.Issue.descp}" /></h4>
	

<h4 align = "left">	<s:label> contact email: </s:label><s:property value="%{#session.Issue.client_email}" /></h4>
	

<h4 align = "left">	<s:label>contact phone no. :</s:label><s:property value="%{#session.Issue.client_phone_no}" /></h4>
<s:form action="assign.action" method = "post">
<% 
if(ActionContext.getContext().getSession().get("loggedin").equals("Developer")){
	
	IssueData issue = (IssueData)ActionContext.getContext().getSession().get("Issue");
	//System.out.println(issue.getAssignedto());
	DeveloperData developer = (DeveloperData)ActionContext.getContext().getSession().get("Developer");
	//ActionContext.getContext().getSession().put("Issue", issue);
	if(issue.getAssignedto()==null){
		System.out.println(developer.getDevelopername());
		System.out.println(issue.getAssignedto());
		System.out.println(issue.getIssue_num());
%>
<s:label>set Priority</s:label>
<s:select theme="simple" name= "priority_selected" headerKey="-1" headerValue="----- Select ----" list ="#{1:'1', 2:'2', 3:'3' }" label = "priority" id = "searchby" size = "1" />

<s:submit name = "assignbutton" id="mysubmit" value="claim issue" align="right"/>

<%
	}
	else{
		System.out.println(developer.getDevelopername().equals(issue.getAssignedto()));
		if(developer.getDevelopername().equals(issue.getAssignedto()))
		{
			%>
		<%
		}
	}
}
else{
%>
<h3 align = "center">	<s:label>Logged in as admin</s:label></h3>

<s:label>set Priority</s:label>
<s:select theme="simple" name= "priority_selected" headerKey="-1" headerValue="----- Select ----" list ="#{1:'1', 2:'2', 3:'3' }" label = "priority" id = "searchby" size = "1" />
<s:label>  Assign to</s:label>

<s:select theme="simple" name= "dev_select" headerKey="-1" headerValue="----- Select ----" list = "DeveloperList" listKey="developername" listValue="developername" label = "Category" id = "searchby" size = "1" />



<s:submit name = "assignbutton" id="mysubmit" value="assign issue" align="right"/>


<%
}
%>
</s:form>

<br/>
<br/>
<h2>comments for this issue</h2>
<s:iterator value = "%{#session.comments}">
<td align="center" colspan="50" ><h4><s:property  value="developerName" /></h4></td>
<s:property value="comment" />
<s:property value = "issue_id"/>
 </s:iterator>
 
 
<s:form action="comment.action" method = "post">
<h4><s:textarea name="comment_box" label = "comment" id="mytextarea" rows="8" cols="40" /></h4>
 <s:submit name = "commandButton" id="mysubmit" value="comment"
      align="center"/>
</s:form>
<s:a href = "upload.jsp">click here </s:a>
<%
if(ActionContext.getContext().getSession().get("loggedin").equals("Developer")){
IssueData issue = (IssueData)ActionContext.getContext().getSession().get("Issue");
//System.out.println(issue.getAssignedto());
DeveloperData developer = (DeveloperData)ActionContext.getContext().getSession().get("Developer");
if(developer.getDevelopername().equals(issue.getAssignedto()))
		{
			%><s:form action = "email.action" method = "post">
			<s:textfield name="email" label = "email-id" id = "myinput"/>		
			<s:textarea name="email_matter" label = "solution" id="mytextarea" rows="8" cols="40" />
			 <s:submit name = "commandButton" id="mysubmit" value="send email" align="center"/>
			 <s:submit name = "commandButton" id="mysubmit" value="mark as solved" align="center"/>
			</s:form>
		<%
		}
}
%>
</fieldset>
</div>

<!-- end of content -->

</div> 
<!-- end of content wrapper -->


<div id="footer_wrapper">        
    
<div id="footer">
        
</div>
<!-- end of footer -->

</div>
<!-- end of footer wrapper -->

</body>

</html>

